<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->systemName;?></title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
</head>

<body>
	<div id="main">
		<div id="navigation">当前位置：<a href="<?php echo $this->projectUrl(array('action'=>'index'));?>">角色列表</a> &gt; <span id="focus">设置“<?php echo $this->row['type'] == 1 ? 'YEK' : '商家';?>”角色“<?php echo $this->row['name'];?>”的菜单</span></div>
		<div id="body">
			<div id="edit">
				<form id="editForm" name="editForm" method="post" action="">
					<table width="100%" border="0" cellpadding="0" cellspacing="0" >
						

						<tr>
							<td>
								<div style="width:100%; margin-top:10px">

									<div style="width:300px; float:left; margin-right:10px; margin-bottom:10px; padding-left:10px; cursor:pointer;" id="productTab" class="productTab" menuType="1" onclick="productMenuTabSelect('1');">产品菜单</div>

<?php
if ($this->row['type'] == 1) {
?>
									<div style="width:300px; float:left; margin-right:10px; margin-bottom:10px; padding-left:10px; cursor:pointer;" id="productTab" class="productTab" menuType="2" onclick="productMenuTabSelect('2');">非产品菜单</div>
<?php
}
?>
								</div>
							</td>
						</tr>
					</table>
				</form>
				<div id="menuBlock">loading...</div>
			</div>
		</div>
	</div>
<script language="javascript">
function productMenuTabSelect(menuType)
{
	$(".productTab").each(function(i){
		if (menuType == $(this).attr('menuType')){
			$(this).css('background', '#ccc');
		} else {
			$(this).css('background', '#eee');
		}
	});
	loadProductMenu(menuType);
}
function loadProductMenu(menuType)
{
	$("#menuBlock").html('loading...');
	
    var url = '<?php echo $this->projectUrl(array('action'=>'menu-html', 'roleId'=>$this->row['id'], 'menuType'=>'{menuType}'), NULL, false);?>'+'?rand/' + Math.random();
	url = url.replace('{menuType}', menuType);

	$.ajax({
		type: "GET",
		url: url,
		dataType: "html",
		async: true,
		success: function(data){
			$("#menuBlock").html(data);
		} 
	});
}
productMenuTabSelect('1');
</script>
</body>
</html>